package com.ruoyi.account.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.core.domain.CxSelect;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.db.domain.ChannelInfo;
import com.ruoyi.db.mapper.ChannelInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.db.mapper.AccountItemChannleMapper;
import com.ruoyi.db.domain.AccountItemChannle;
import com.ruoyi.account.service.IAccountItemChannleService;
import com.ruoyi.common.core.text.Convert;

/**
 * 渠道账户信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-02-02
 */
@Service
@DataSource(DataSourceType.SLAVE)
public class AccountItemChannleServiceImpl implements IAccountItemChannleService 
{
    @Autowired
    private AccountItemChannleMapper accountItemChannleMapper;
    @Autowired
    private ChannelInfoMapper channelInfoMapper;

    /**
     * 查询渠道账户信息
     * 
     * @param id 渠道账户信息主键
     * @return 渠道账户信息
     */
    @Override
    public AccountItemChannle selectAccountItemChannleById(Long id)
    {
        return accountItemChannleMapper.selectAccountItemChannleById(id);
    }

    /**
     * 查询渠道账户信息列表
     * 
     * @param accountItemChannle 渠道账户信息
     * @return 渠道账户信息
     */
    @Override
    public List<AccountItemChannle> selectAccountItemChannleList(AccountItemChannle accountItemChannle)
    {
        return accountItemChannleMapper.selectAccountItemChannleList(accountItemChannle);
    }

    /**
     * 查询渠道账户信息列表
     *
     * @param accountItemChannle 渠道账户信息
     * @return 渠道账户信息
     */
    @Override
    public List<Map<String, Object>> selectAccountItemChannleListMap(AccountItemChannle accountItemChannle)
    {
        return accountItemChannleMapper.selectAccountItemChannleListMap(accountItemChannle);
    }

    /**
     * 新增渠道账户信息
     * 
     * @param accountItemChannle 渠道账户信息
     * @return 结果
     */
    @Override
    public int insertAccountItemChannle(AccountItemChannle accountItemChannle)
    {

        accountItemChannle.setCreateTime(DateUtils.getNowDate());
        return accountItemChannleMapper.insertAccountItemChannle(accountItemChannle);
    }

    /**
     * 修改渠道账户信息
     * 
     * @param accountItemChannle 渠道账户信息
     * @return 结果
     */
    @Override
    public int updateAccountItemChannle(AccountItemChannle accountItemChannle)
    {
        accountItemChannle.setUpdateTime(DateUtils.getNowDate());
        return accountItemChannleMapper.updateAccountItemChannle(accountItemChannle);
    }

    /**
     * 批量删除渠道账户信息
     * 
     * @param ids 需要删除的渠道账户信息主键
     * @return 结果
     */
    @Override
    public int deleteAccountItemChannleByIds(String ids)
    {
        return accountItemChannleMapper.deleteAccountItemChannleByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除渠道账户信息信息
     * 
     * @param id 渠道账户信息主键
     * @return 结果
     */
    @Override
    public int deleteAccountItemChannleById(Long id)
    {
        return accountItemChannleMapper.deleteAccountItemChannleById(id);
    }

    @Override
    public List<CxSelect> selectChannelSelectList() {
        return accountItemChannleMapper.selectChannelSelectList();
    }
}
